package example.data;

import java.io.Serializable;
import java.util.List;
import java.util.Random;


import example.data.Person;
/**Klasa generuje dane do wy�wietlenia*/
public class Generate implements Serializable {
	
	Random random = new Random();
	private final static String[] names;				//statyczne tablice z imionami i nazwiskami potrzebnymi do wygenerowania osoby
	private final static String[] surnames;
	static {
		names = new String[10];
		names[0] = "Marek";
		names[1] = "Jarek";
		names[2] = "Darek";
		names[3] = "Adrian";
		names[4] = "Mateusz";
		names[5] = "Kamil";
		names[6] = "Pawel";
		names[7] = "Roman";
		names[8] = "Tadeusz";
		names[9] = "Mariusz";

		surnames = new String[10];
		surnames[0] = "Kowalski";
		surnames[1] = "Mikolajczyk";
		surnames[2] = "Nowak";
		surnames[3] = "Krotki";
		surnames[4] = "Nieziemski";
		surnames[5] = "Kalosz";
		surnames[6] = "Portfel";
		surnames[7] = "Guzik";
		surnames[8] = "Bak";
		surnames[9] = "Korek";
	}
	/**losowanie liczby zarobkow*/
	private int randomBalance() {							 
		// TODO Auto-generated method stub
		return random.nextInt(4000) + 1000;
	}
	/**losowanie  daty*/
	private String randomDate() {							
		String date = "";
		int year = random.nextInt(113) + 1900;
		int month = random.nextInt(12) + 1;
		int day = random.nextInt(28) + 1;
		date += day + "/" + month + "/" + year;
		return date;
	}
	/**losowanie nazwiska*/
	private String randomSurname() {						
		// TODO Auto-generated method stub
		return surnames[random.nextInt(10)];
	}
	/**losowanie imienia*/
	private String randomName() {							
		// TODO Auto-generated method stub
		return names[random.nextInt(10)];
	}
	/**
	 * @param daneOsobowe	lista do kt�rej maj� by� wstawione dane
	 * @param size			liczba os�b do wygenerowania
	 * @return				wygenerowana lista os�b
	 */
	public List<Person> populateRandomPeople(List<Person> personalData, int size) {			
		for (int i = 0; i < size; i++) {
			personalData.add(new Person(randomName(), randomSurname(), i + 1,				//dodawanie osoby do listy
					randomDate(), randomBalance()));
		}
		return personalData;
	}

}
